home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 42
/
Amiga Format AFCD42 (Issue 126, Aug 1999).iso
/
-serious-
/
programming
/
other
/
wild
/
appunti
/
loader.txt
< prev
next >
Wrap
Text File
|
1999-05-25
|
3KB
|
79 lines
Loader module design.
It's a new king of module, the only special thing is that you cannot modify it via
prefs editing, because only the app selects his loader. So, no type needed, because
the app selects his filetype, loading the ok module. No optimized versions for cpu
are needed, because a loader has only to be robust and easy to port/rewrite: not to
be fast!
Loader module funcs:
STD module funcs: the unused ones are RESERVED, now pointed to a rts).
LoadLevel(tags) returns a LEVEL struct.
LoadAlien(tags) used to load SuperAliens (player...)
(Re)LoadTexture(tags) used to re-load the textures.
More: the RefreshModule does the level-loading, if changed.
NO! Everything Changed, new ideas !
New concepts...
WildBuild function made.
the LoadWildObject func will be manager hi-level by wild, and low-level by loader
modules.
So, the app will ask to wild: LoadWildObject(): load me an alien from this file,
position it in a position, link it to that... so, LoadWildObject will first
load the object's attributes, then will call the WildBuild func to build it,
using also the tags given by the app (the parent,... wich are not defined in the
file.)
The LoadWildObject will call the LoaderModule, and can ask:
LoadObject(...): loads an object from a file, a ???, decided via tags. This object
is keeped in memory in the Module's format.
GetObjectAttr(obj,attr,default):
asks to the loader an attribute of an object. May ask a value, like
the object's color, or the object's position, NOT object's childs.
Links to other friend objects are considered like attrs.
If the attr is not supported, always return 0!
NOTE: The loader must KNOW the type of the object passed!
nOTE: The loader must give also the sub-attrs: explain better:
an ARENA also have all ALIEN's attrs, and an ALIEN has also
all the ENTITY attrs,...
NextObjectChild(obj,prec,childtype): asks to the loader the next child of the object. Every time, you
pass the precedent object (or NULL at start) and that will find
for you the next child. May even ask for a specific type of child.
FreeObject(...): passes the object, and the module has to free all what it made for that,
even tmp data or what else. A Pool use is HIGHLY recommenced: it's very
secure, less memory frag, no forget pieces of mem...
MadeObjectIs(obj,defobj): passes the made (wild format) object, and the Loader's format
object. Needed to have a pointer to an already made alien, for
example when you made all the aliens you can set the World's
Player, but not before ! So, the Loader must know the location
of the made player to say you.
BUT: Any kind of loaded must respect this tree, or a sub-part of it:
Level
#
|-Scene
| #Camera
| #Palette
| |
| |-World
| | #Player
| | #